local chuanshu = fk.CreateSkill{
  name = "kl__chuanshu",
  tags = { Skill.Limited },
}

Fk:loadTranslationTable{
  ["kl__chuanshu"] = "传术",
  [":kl__chuanshu"] = "限定技，当你进入濒死状态时，你可以<a href='kl__busuan_des'>卜算</a>七张牌，然后你令一名角色摸三张牌，并令其获得<a href=':kl__jizhi'>“集智”</a>。",

  ["kl__busuan_des"] = "卜算X，即：观看牌堆顶的X张牌，将这些牌以任意顺序置于牌堆顶或牌堆底",
  ["#kl__chuanshu-choose"] = "传术：选择一名角色，令其摸三张牌并获得“集智”(使用锦囊牌时摸1张牌，以此法获得的牌本回合不计入手牌上限)",

  ["$kl__chuanshu1"] = "才如泉涌，用之不竭！",
  ["$kl__chuanshu2"] = "才如泉涌，用之不竭！",
}

chuanshu:addEffect(fk.EnterDying, {
  anim_type = "support",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(chuanshu.name) and player:usedSkillTimes(chuanshu.name, Player.HistoryGame) == 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:askToGuanxing(player, { cards = room:getNCards(7) })
    if player.dead then return end
    local to = room:askToChoosePlayers(player, {
      min_num = 1,
      max_num = 1,
      targets = room.alive_players,
      skill_name = chuanshu.name,
      prompt = "#kl__chuanshu-choose",
      cancelable = false,
    })
    if #to > 0 then
      to[1]:drawCards(3, chuanshu.name)
      room:handleAddLoseSkills(to[1], "kl__jizhi")
    end
  end,
})


return chuanshu
